package com.gupaoedu.vip.mongo.explorer.common.config;

import com.mongodb.MongoClientURI;
import lombok.Data;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;

@Data
public abstract class AbstractMongoConfig {

    private String uri;

    protected MongoDbFactory mongoDbFactory(){
        return new SimpleMongoDbFactory(new MongoClientURI(uri));
    }
    public abstract MongoTemplate getMongoTemplate() throws Exception;

}
